//2009/08/25 19:59:33
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class ImportantTasks
{
public:
    int maximalCost(vector <int> complexity, vector <int> computers)
    {
		sort(computers.rbegin(), computers.rend());
		sort(complexity.rbegin(), complexity.rend());
		int ret = 0;
		for(int i=0, j=0; i<computers.size()&&j<complexity.size(); )
		{
			if(computers[i] >= complexity[j])
			{
				ret ++;
				i++;
				j++;
			}
			else
			{
				j++;
			}
		}
		return ret;
    }
};
